<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>酷炫的文字悬停效果</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <h2 class="text">Vanilla JavaScript</h2>
</body>
<script>
  let text = document.querySelector('.text')
  text.innerHTML = text.innerText.split('').map((letters, i) => {
    return `<span style="transition-delay:${i * 40}ms;filter:hue-rotate(${i * 30}deg)">${letters}</span>`
  }).join('')
</script>

</html>